home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / OpenDoc 1.2b2c1 / Implementation / OpenDocSetup / ST_MacClasses.h < prev   
Encoding:
C/C++ Source or Header  |  1997-02-13  |  2.8 KB  |  125 lines  |  [TEXT/MMCC]

  1. /*
  2.     File:        ST_MacClasses.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Owned by:    Nick Pilch
  7.  
  8.     Copyright:    © 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <2>     6/23/96    NP        10002: Launch time speedups.
  13.          <1>     6/21/96    NP        first checked in
  14.  
  15.     To Do:
  16. */
  17.  
  18. #ifndef ST_MACCLASSES_H
  19. #define ST_MACCLASSES_H
  20.  
  21. #ifndef DECLARE_ST_
  22. #include "ST_.h"
  23. #endif
  24.  
  25. #ifndef __MIXEDMODE__
  26. #include <MixedMode.h>
  27. #endif
  28.  
  29. #ifndef __CODEFRAGMENTS__
  30. #include <CodeFragments.h>
  31. #endif
  32.  
  33. #ifndef __ALIASES__
  34. #include <Aliases.h>
  35. #endif
  36.  
  37. #ifndef __RESOURCES__
  38. #include <Resources.h>
  39. #endif
  40.  
  41. #ifndef __APPLEEVENTS__
  42. #include <AppleEvents.h>
  43. #endif
  44.  
  45. #ifndef __QUICKDRAW__
  46. #include <QuickDraw.h>
  47. #endif
  48.  
  49. /* Memory Manager */
  50. DECLARE_ST_ (ST_Ptr, Ptr, DisposePtr, nil)
  51. DECLARE_ST_ (ST_Handle, Handle, DisposeHandle, nil)
  52. DECLARE_ST_ (ST_ZoneSaver, THz, SetZone, nil)
  53.  
  54. /* Resource Manager */
  55. DECLARE_ST_ (ST_ResourceHandle, Handle, ReleaseResource, nil)
  56. DECLARE_ST_ (ST_ResFileSaver, short, UseResFile, -1)
  57. DECLARE_ST_ (ST_ResFileCloser, short, CloseResFile, -1)
  58.  
  59. /* QuickDraw */
  60. DECLARE_ST_ (ST_GrafPortSaver, GrafPtr, SetPort, nil)
  61. DECLARE_ST_ (ST_RgnHandle, RgnHandle, DisposeRgn, nil)
  62.  
  63. /* File Manager */
  64. DECLARE_ST_ (ST_FileCloser, short, FSClose, 0)
  65.  
  66. /* MixedMode Manager */
  67.  
  68. /* temporarily turn off ';' warning generated under 68K builds */
  69. #pragma warn_possunwant off
  70. DECLARE_ST_ (ST_RoutineDescriptor, UniversalProcPtr, DisposeRoutineDescriptor, nil)
  71. #pragma warn_possunwant reset
  72.  
  73.  
  74. /* Code fragment manager */
  75. //DECLARE_STP_ (ST_ConnectionID, ConnectionID, CloseConnection, 0)
  76.  
  77. /* AppleEvent Manager */
  78. class ST_AEDesc {
  79.     private:
  80.         AEDesc    theAEDesc;
  81.         void operator = (const AEDesc &aAEDesc);
  82.     public:
  83.         ST_AEDesc (const AEDesc &aAEDesc) {theAEDesc = aAEDesc;}
  84.         ~ST_AEDesc () {if (theAEDesc.dataHandle) AEDisposeDesc (&theAEDesc);}
  85.         operator AEDesc& (void) {return theAEDesc;}
  86.         void Forget (void) {theAEDesc.dataHandle = nil;}
  87. };
  88.  
  89. /* Alias Manager */
  90. class ST_AliasHandle {                                                                                
  91.     private:
  92.         AliasHandle    theAlias;
  93.         void operator = (const AliasHandle &anAlias);
  94.     public:
  95.         ST_AliasHandle (const AliasHandle &anAlias) {theAlias = anAlias;}
  96.         ~ST_AliasHandle () {if (theAlias) DisposeHandle ((Handle)theAlias);}
  97.         operator AliasHandle& (void) {return theAlias;}
  98.         void Forget (void) {theAlias = nil;}
  99. };
  100.  
  101. /* More Memory Manager... */
  102.  
  103. class ST_HandleStateSaver {                                                                                
  104.     private:
  105.         Handle            theHandle;
  106.         SignedByte        theState;
  107.         void operator = (const Handle &aHandle);
  108.     public:
  109.         ST_HandleStateSaver (const Handle &aHandle) : theHandle (aHandle) {theState = HGetState (aHandle);}
  110.         ~ST_HandleStateSaver () {if (theHandle) RestoreState ();}
  111.         operator SignedByte& (void) {return theState;}
  112.         void Forget (void) {theHandle = nil;}
  113.         void RestoreState (void) {HSetState (theHandle, theState); }
  114. };
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124. #endif
  125.